<?php
require_once("action/sys_conf.inc");
if(isset($_GET[id])){
	$link_id = mysql_connect($DBHOST,$DBUSER,$DBPWD);
	mysql_select_db($DBNAME);
	mysql_query("SET NAMES 'utf8'");	
	$id = $_GET[id];
	$sql1 = "select id,name,introduction,amount from extpollitems where id='$id'";
	$result1 = mysql_query($sql1);

	if(!mysql_num_rows($result1)){
		echo "Sorry,目前没有数据";
		exit;
	}
	else{
		$option = mysql_fetch_assoc($result1);
		$oid = $option[id];
		$name =  $option[name];
		$introduction = $option[introduction];
		$amount = $option[amount];	
		
		$result2 = mediaSql($oid,0);
?>
<div class="">
	<div>
		<?php 
			if(!mysql_num_rows($result2)){ 
				echo '无图片'; 
			} else { 
				$media = mysql_fetch_assoc($result2); 
				$path = $media[path];
				$title = $media[title];
				echo '<img src="/poll/'.$path.'" title="'.$title.'" width="100" />';
			} 
		?>
	</div>
	<div><?php echo $name ?></div>
	<div><?php echo $amount?>票</div>
</div>
<dl>
	<dt>
	<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
  <tr>
    <td onmouseover="javascript:flip(1)">个人介绍</td>
    <td onmouseover="javascript:flip(2)">相片</td>
    <td onmouseover="javascript:flip(3)">视频</td>
  </tr>
</table>
	</dt>
	<dd id="description"><?php echo $introduction ?></dd>
	<dd id="photo">
	<?php 
		$photo = mediaSql($oid,0);
		if(!mysql_num_rows($photo)){ 
			echo '无图片'; 
		} else { 
			while($media = mysql_fetch_assoc($photo)){ 
				$path = $media[path];
				$title = $media[title];
				$listVisible = $media[listVisible];
				$lv = ($listVisible ? "":"不");
				echo '
				<div style="float:left;width:200px">
				<div class="photo_img"><img src="/poll/'.$path.'" title="'.$title.'" width="100" /></div>
				<div class="photo_name">'.$title.'</div>
				<div class="list_show">列表页'.$lv.'显示</div>
				</div>
				';
			}
		} 
	?>
	</dd>
	<dd id="video">
		<?php 
			$video = mediaSql($oid,1);
			if(!mysql_num_rows($video)){ 
			echo '无视频'; 
			} else {
			while($media = mysql_fetch_assoc($video)){ 
				$path = $media[path];
		?>
  <table width="100%" border="0">
    <tr>
      <td>
			  <object id="player" height="64" width="260" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"> 
				<param NAME="AutoStart" VALUE="-1">  
				<param NAME="Balance" VALUE="0"> 
				<param name="enabled" value="-1"> 
				<param NAME="EnableContextMenu" VALUE="-1"> 
				<param NAME="url" value="/poll/<?php echo $path ?>"> 
				<param NAME="PlayCount" VALUE="1">  
				<param name="rate" value="1"> 
				<param name="currentPosition" value="0"> 
				<param name="currentMarker" value="0"> 
				<param name="defaultFrame" value=""> 
				<param name="invokeURLs" value="0"> 
				<param name="baseURL" value=""> 
				<param name="stretchToFit" value="0"> 
				<param name="volume" value="50">  
				<param name="mute" value="0"> 
				<param name="uiMode" value="mini">  
				<param name="windowlessVideo" value="0"> 
				<param name="fullScreen" value="0"> 
				<param name="enableErrorDialogs" value="-1"> 
				</object>
		  </td>
    </tr>
  </table>
	<?php }} ?>
	</dd>
</dl>
<?php } } ?>
<?php 
	function mediaSql($oid,$mediaType){
		$sql = "select id,title,path,mediaType,listVisible from extpollmedia where subjectItemId='$oid' and mediaType='$mediaType' order by id asc";
		return mysql_query($sql);
	}
?>
<script language="javascript" type="text/javascript">
	$(document).ready(function(){
  flip(1);
  });
function flip(n){
	switch(n){
	 case 1:
	 	$("#description").show();
	 	$("#photo").hide();
	 	$("#video").hide();
	 	break;
	 case 2:
	 	$("#description").hide();
	 	$("#photo").show();
	 	$("#video").hide();
	 	break;
	 case 3:
	 	$("#description").hide();
	 	$("#photo").hide();
	 	$("#video").show();
	 	break;
	}
}
</script>